package com.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dao.AdminDAO;
import com.pojo.Admin;
import com.util.PasswordUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@SuppressWarnings("ALL")
@Service
public class AdminServiceImp extends ServiceImpl<AdminDAO,Admin> implements AdminService {
    @Autowired
    private AdminDAO adminDAO;

    @Override
    public Admin login(String username, String password) {
        //密码加密
        String jiami_password = PasswordUtil.jiami(password);
        QueryWrapper q = new QueryWrapper();
        q.eq("username", username);
        q.eq("password", jiami_password);
        Admin admin = adminDAO.selectOne(q);
        return admin;
    }
}
